import Docker from "dockerode";
import 'dotenv/config'
import { getContainerRuntimeClient } from "testcontainers";
import { PatchedNpipeSocketStrategy } from './npipe-socket-strategy-patch.js';

async function main() {
    PatchedNpipeSocketStrategy();
    const client = await getContainerRuntimeClient();
    const info = client.info;
    const dockerode = client.container.dockerode;
    const test = dockerode.modem;
    test.version = "v" + info.containerRuntime.serverVersion + '/libpod';
    const containers = await dockerode.listContainers();
    const looper = dockerode.getContainer(containers[0].Id);
    await looper.createCheckpoint({
        leaveRunning: true
    });
    await looper.kill();
    await looper.restoreCheckpoint({
    });
}

await main();